#ifndef _APPS_BDESKTOP_CAPPLICATION_H_
#define _APPS_BDESKTOP_CAPPLICATION_H_

#include "auto.h"
#include <buola/os/capplication.h>
#include "cclient.h"
#include "cdockicon.h"

namespace buola { namespace bdesktop {

class CApplication
{
public:
    struct SClient
    {
        CClient *mClient;
        CDockIcon *mIcon;
    };

    CApplication(CAppManager *pManager,os::CApplication *pType);
    virtual ~CApplication();
    
    bool ShouldHaveAppIcon();
    void AdjustAppIcon();

    void FillMenu(gui::PMenu pMenu);

    void OnClientAdded(CClient *pClient);
    void OnClientRemoved(SClient *pClient);

    void OnIconClicked(gui::CMouseEvent *pE,SClient *pClient);
    void OnIconPosChanged(const CRect &pRect,SClient *pClient);
    void OnAppIconClicked(gui::CMouseEvent *pE);
    void OnAppIconPosChanged(const CRect &pRect);

    void OnKeepInDock();
    void OnNewWindow();

    CAppManager *mManager;
    os::CApplication *mType;

    CDockIcon *mAppIcon;

    std::vector<SClient*> mClients;

    bool mKeepInDock;
};

/*namespace bdesktop*/ } /*namespace buola*/ }

#endif
